/**
 * made by xufeng
 * Jul 9, 2008 10:26:36 AM
 *  
 */
package com.litxuf.util;

import java.io.File;
import java.io.InputStream;
import java.util.Locale;
import java.util.Properties;

/**
 * @author xuFeng
 * 
 */
public class PropertiesUtil {
	private static InputStream i;

	private static Properties p;

	private static String UserDirectoryFile = "siteConfig.properties";

	/**
	 * 
	 */
	static {

		i = PropertiesUtil.class.getClassLoader().getResourceAsStream(
				UserDirectoryFile);

		if (null == i) {
		} else {
			try {
				p = new Properties();
				p.load(i);
				i.close();
			} catch (java.io.IOException e) {
				p = null;

			} finally {
				i = null;

			}
		}
	}

	/**
	 * 
	 * @param sqlName
	 * @return
	 */
	public static String getValueByKey(String key) {
		return p.getProperty(key);
	}

	public static void setValue(String key, String value) {
		p.put(key, value);
	}

	public static void main(String[] args) {
		//System.out.println(getValueByKey("path"));
		//setValue("path", "123654");
		// System.out.println(getValueByKey("path"));
		System.out.println(PropertiesUtil.class.getClassLoader()
				.getResource(""));
 String s=PropertiesUtil.class.getResource("").getPath();
        
 System.out.println("aa"+s);
		System.out.println("=="+ClassLoader.getSystemResource(""));
		System.out.println(PropertiesUtil.class.getResource(""));
		System.out.println(PropertiesUtil.class.getResource("/")); // Class文件所在路径
		System.out.println(System.getProperty("user.dir"));

	}
}
